var refreshIntervalId = setInterval(function(){SiteTreeCreation()},100); 

function SiteTreeCreation(){
	try{
		console.log('checking');
		var checkLi = $("#header li .navitem");
	}
	catch(err){
	}
		
	if(checkLi.length >= 2){
		console.log('done');
		clearInterval(refreshIntervalId);
		
		$("#header li .navitem").bind("click", function(e) {
			$("#header li .navitem").not(e.target).removeClass("tabselected");
			$("#header li .navitem").not(e.target).removeClass("selected");
			$(e.target).addClass("tabselected");
		});

		return false;
	}	
}

